//
//  HR_PickCollectionViewCell.m
//  HR_PickKit
//
//  Created by KK on 2017/7/20.
//  Copyright © 2017年 Mac. All rights reserved.
//

#import "HR_PickCollectionViewCell.h"

@interface HR_PickCollectionViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *pickImage;

@property (strong, nonatomic) PHCachingImageManager *imageManager;
@end

@implementation HR_PickCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)updatePickCell:(PHAsset *)asset{
    WEAK(weakSelf);
    [self.imageManager requestImageForAsset:asset targetSize:CGSizeMake(self.bounds.size.width, self.bounds.size.width) contentMode:PHImageContentModeAspectFit options:nil resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
        weakSelf.pickImage.image = result;
    }];
}

- (PHCachingImageManager *)imageManager {
    if (!_imageManager) {
        _imageManager = [[PHCachingImageManager alloc] init];
    }
    return _imageManager;
}
@end
